//
//  DWDBaseNavViewController.swift
//  dwdWb
//
//  Created by Dengdwd on 15/10/9.
//  Copyright © 2015年 dwd. All rights reserved.
//

import UIKit

class DWDBaseNavViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
        
    }
    
    @objc private func back() {
        popViewControllerAnimated(true)
    }

    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if childViewControllers.count  > 0 {
           var titleName = "返回"
        if childViewControllers.count == 1 {
           titleName = childViewControllers.first!.title!
            }
            viewController.hidesBottomBarWhenPushed = true
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem.item("navigationbar_back_withtext", title:titleName, target: self, action: "back")
        }
        
        super.pushViewController(viewController, animated: animated)
    }



}
